In [10]:
import numpy as np
from qutip import *
These are the polarization states:
In [11]:
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/np.sqrt(2)],[1/np.sqrt(2)]])
M45 = Qobj([[1/np.sqrt(2)],[-1/np.sqrt(2)]])
R = Qobj([[1/np.sqrt(2)],[-1j/np.sqrt(2)]])
L = Qobj([[1/np.sqrt(2)],[1j/np.sqrt(2)]])
In [12]:
V
Out[12]:
Devices:
HWP - Half-wave plate axis at $\theta$ to the horizontal
LP - Linear polarizer, axis at $\theta$
QWP - Quarter-wave plate, axis at $\theta$
Note, these are functions so you need to call them with a specific value of theta.
In [18]:
def HWP(theta):
return Qobj([[np.cos(2*theta),np.sin(2*theta)],[np.sin(2*theta),-np.cos(2*theta)]]).tidyup()
In [19]:
def LP(theta):
return Qobj([[np.cos(theta)**2,np.cos(theta)*np.sin(theta)],[np.sin(theta)*np.cos(theta),np.sin(theta)**2]]).tidyup()
In [20]:
def QWP(theta):
return Qobj([[np.cos(theta)**2 + 1j*np.sin(theta)**2,
(1-1j)*np.sin(theta)*np.cos(theta)],
[(1-1j)*np.sin(theta)*np.cos(theta),
np.sin(theta)**2 + 1j*np.cos(theta)**2]]).tidyup()
In [22]:
QWP(np.pi/4)
Out[22]:
In [23]:
H.dag()*H
Out[23]:
To show more information on an object, use the question mark after the function or object:
In [25]:
np.sin?
In [26]:
psi = Qobj([[1+1j],[2-1j]])
psi
Out[26]:
In [27]:
psi.dag()
Out[27]:
In [17]:
psi.dag().dag()
Out[17]:
the .dag()
python method computes the "daggar" or the complex transpose.